﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace XxSystem.FileManager.core
{
    public class CusExceptionFilter : IExceptionFilter
    {
        public void OnException(ExceptionContext context)
        {
            context.Result = new ObjectResult(new BaseResult() { 
                Id = Guid.NewGuid().ToString(),
                Msg = context.Exception.Message,
                Status = -1
            });
            context.HttpContext.Response.StatusCode = 200;       
            context.ExceptionHandled = true;
        }
    }
}
